set mem 550m
set matsize 5000
log using "G:\whalley\projects\college_spending\programs\analysis\RESTAT_final\tableA1_M1.log", replace
#delimit ;
set more 1;
*
* TABLEA1_M1.DO
* BY Alex Whalley
* VERSION OF 08/01/08
*;
use "G:\whalley\projects\college_spending\programs\analysis\RESTAT_final\main_data.dta";
*
* KEEP ONLY ABOVE MEDIAN GRAD FRACT COUNTIES
*;
keep if mfrac_grad81 == 1;
*
* DROP SMALL COUNTIES
*;
drop if totpop < 250000;
*
* REORMALIZE TOTAL EXPENDITURE
*;
gen ECFET3d1p = ECFET3d1 / 1000; 
drop ECFET3d1;
rename ECFET3d1p ECFET3d1;
gen ECFET3d3p = ECFET3d3 / 1000; 
drop ECFET3d3;
rename ECFET3d3p ECFET3d3;
gen endowl4_spindexd3d1_1 = endowl4_spindexd3d1 / 1000;
drop endowl4_spindexd3d1;
rename endowl4_spindexd3d1_1 endowl4_spindexd3d1;
collapse (mean) ECFET3d1 endowl4_spindexd3d1 lincome3d1 lemp3d1 (sum) semp81, by(year FIPSCOUNTY); 
*
* PART (1): DO REGRESSIONS WITH SIC FES AND CORRELATIONS
*
* PART (A): LOOK AT IV FIRST STAGE
*;
xi: reg ECFET3d1 endowl4_spindexd3d1 i.year [fw=semp81], cluster(FIPSCOUNTY);
test endowl4_spindexd3d1;
sum ECFET3d1 if endowl4_spindexd3d1 !=.;
*
* PART (B1): INCOME
*;
xi: ivreg lincome3d1 (ECFET3d1=endowl4_spindexd3d1 ) i.year [fw=semp81] , cluster(FIPSCOUNTY); 
sum lincome3d1 if endowl4_spindexd3d1 != .;
*
* READ IN DATA
* 
* NOTE: ALL VALUES ARE NOMINAL
*;
clear;
* 
* NOTE: ALL VALUES ARE NOMINAL
*;
use "G:\whalley\projects\college_spending\programs\analysis\RESTAT_final\main_data.dta", replace;
*
* KEEP ONLY BELOW MEDIAN GRAD FRAC COUNTIES
*;
keep if mfrac_grad81 == 0;
*
* DROP SMALL COUNTIES
*;
drop if totpop < 250000;
*
* REORMALIZE TOTAL EXPENDITURE
*;
gen ECFET3d1p = ECFET3d1 / 1000; 
drop ECFET3d1;
rename ECFET3d1p ECFET3d1;
gen ECFET3d3p = ECFET3d3 / 1000; 
drop ECFET3d3;
rename ECFET3d3p ECFET3d3;
gen endowl4_spindexd3d1_1 = endowl4_spindexd3d1 / 1000;
drop endowl4_spindexd3d1;
rename endowl4_spindexd3d1_1 endowl4_spindexd3d1;
collapse (mean) ECFET3d1 endowl4_spindexd3d1 lincome3d1 lemp3d1 (sum) semp81, by(year FIPSCOUNTY); 
*
* PART (1): DO REGRESSIONS WITH SIC FES AND CORRELATIONS
*
* PART (A): LOOK AT IV FIRST STAGE
*;
xi: reg ECFET3d1 endowl4_spindexd3d1 i.year [fw=semp81], cluster(FIPSCOUNTY);
test endowl4_spindexd3d1;
*
* PART (B1): INCOME
*;
xi: ivreg lincome3d1 (ECFET3d1=endowl4_spindexd3d1 ) i.year [fw=semp81] , cluster(FIPSCOUNTY); 
sum lincome3d1 if endowl4_spindexd3d1 != .;

sum ECFET3d1 if endowl4_spindexd3d1 !=.;
*
* READ IN DATA
* 
* NOTE: ALL VALUES ARE NOMINAL
*;
clear;
* 
* NOTE: ALL VALUES ARE NOMINAL
*;
use "G:\whalley\projects\college_spending\programs\analysis\RESTAT_final\main_data.dta", replace;
*
* KEEP ONLY ABOVE MEDIAN POOLING INDUSTRIES COUNTIES
*;
keep if high_trans_prob == 1;
*
* DROP SMALL COUNTIES
*;
drop if totpop < 250000;
*
* REORMALIZE TOTAL EXPENDITURE
*;
gen ECFET3d1p = ECFET3d1 / 1000; 
drop ECFET3d1;
rename ECFET3d1p ECFET3d1;
gen ECFET3d3p = ECFET3d3 / 1000; 
drop ECFET3d3;
rename ECFET3d3p ECFET3d3;
gen endowl4_spindexd3d1_1 = endowl4_spindexd3d1 / 1000;
drop endowl4_spindexd3d1;
rename endowl4_spindexd3d1_1 endowl4_spindexd3d1;
collapse (mean) ECFET3d1 endowl4_spindexd3d1 lincome3d1 lemp3d1 (sum) semp81, by(year FIPSCOUNTY); 
*
* PART (1): DO REGRESSIONS WITH SIC FES AND CORRELATIONS
*
* PART (A): LOOK AT IV FIRST STAGE
*;
xi: reg ECFET3d1 endowl4_spindexd3d1 i.year [fw=semp81], cluster(FIPSCOUNTY);
test endowl4_spindexd3d1;
*
* PART (B1): INCOME
*;
xi: ivreg lincome3d1 (ECFET3d1=endowl4_spindexd3d1 ) i.year [fw=semp81] , cluster(FIPSCOUNTY); 
sum lincome3d1 if endowl4_spindexd3d1 != .;
sum ECFET3d1 if endowl4_spindexd3d1 !=.;
*
* READ IN DATA
* 
* NOTE: ALL VALUES ARE NOMINAL
*;
clear;
* 
* NOTE: ALL VALUES ARE NOMINAL
*;
use "G:\whalley\projects\college_spending\programs\analysis\RESTAT_final\main_data.dta", replace;
*
* KEEP ONLY BELOW MEDIAN POOLING INDUSTRIES 
*;
keep if high_trans_prob == 0;
*
* DROP SMALL COUNTIES
*;
drop if totpop < 250000;
*
* REORMALIZE TOTAL EXPENDITURE
*;
gen ECFET3d1p = ECFET3d1 / 1000; 
drop ECFET3d1;
rename ECFET3d1p ECFET3d1;
gen ECFET3d3p = ECFET3d3 / 1000; 
drop ECFET3d3;
rename ECFET3d3p ECFET3d3;
gen endowl4_spindexd3d1_1 = endowl4_spindexd3d1 / 1000;
drop endowl4_spindexd3d1;
rename endowl4_spindexd3d1_1 endowl4_spindexd3d1;
collapse (mean) ECFET3d1 endowl4_spindexd3d1 lincome3d1 lemp3d1 (sum) semp81, by(year FIPSCOUNTY); 
*
* PART (1): DO REGRESSIONS WITH SIC FES AND CORRELATIONS
*
* PART (A): LOOK AT IV FIRST STAGE
*;
xi: reg ECFET3d1 endowl4_spindexd3d1 i.year [fw=semp81], cluster(FIPSCOUNTY);
test endowl4_spindexd3d1;
*
* PART (B1): INCOME
*;
xi: ivreg lincome3d1 (ECFET3d1=endowl4_spindexd3d1 ) i.year [fw=semp81] , cluster(FIPSCOUNTY); 
sum lincome3d1 if endowl4_spindexd3d1 != .;
sum ECFET3d1 if endowl4_spindexd3d1 !=.;
*
* READ IN DATA
* 
* NOTE: ALL VALUES ARE NOMINAL
*;
clear;
* 
* NOTE: ALL VALUES ARE NOMINAL
*;
use "G:\whalley\projects\college_spending\programs\analysis\RESTAT_final\main_data.dta", replace;
*
* KEEP ONLY ABOVE MEDIAN PATENT INDUSTRIES
*;
keep if high_frac_univ == 1;
*
* DROP SMALL COUNTIES
*;
drop if totpop < 250000;
*
* REORMALIZE TOTAL EXPENDITURE
*;
gen ECFET3d1p = ECFET3d1 / 1000; 
drop ECFET3d1;
rename ECFET3d1p ECFET3d1;
gen ECFET3d3p = ECFET3d3 / 1000; 
drop ECFET3d3;
rename ECFET3d3p ECFET3d3;
gen endowl4_spindexd3d1_1 = endowl4_spindexd3d1 / 1000;
drop endowl4_spindexd3d1;
rename endowl4_spindexd3d1_1 endowl4_spindexd3d1;
collapse (mean) ECFET3d1 endowl4_spindexd3d1 lincome3d1 lemp3d1 (sum) semp81, by(year FIPSCOUNTY); 
*
* PART (1): DO REGRESSIONS WITH SIC FES AND CORRELATIONS
*
* PART (A): LOOK AT IV FIRST STAGE
*;
xi: reg ECFET3d1 endowl4_spindexd3d1 i.year [fw=semp81], cluster(FIPSCOUNTY);
test endowl4_spindexd3d1;
*
* PART (B1): INCOME
*;
xi: ivreg lincome3d1 (ECFET3d1=endowl4_spindexd3d1 ) i.year [fw=semp81] , cluster(FIPSCOUNTY); 
sum lincome3d1 if endowl4_spindexd3d1 != .;
sum ECFET3d1 if endowl4_spindexd3d1 !=.;
*
* READ IN DATA
* 
* NOTE: ALL VALUES ARE NOMINAL
*;
clear;
* 
* NOTE: ALL VALUES ARE NOMINAL
*;
use "G:\whalley\projects\college_spending\programs\analysis\RESTAT_final\main_data.dta", replace;
*
* KEEP ONLY BELOW MEDIAN PATENT INDUSTRIES
*;
keep if high_frac_univ == 0;
*
* DROP SMALL COUNTIES
*;
drop if totpop < 250000;
*
* REORMALIZE TOTAL EXPENDITURE
*;
gen ECFET3d1p = ECFET3d1 / 1000; 
drop ECFET3d1;
rename ECFET3d1p ECFET3d1;
gen ECFET3d3p = ECFET3d3 / 1000; 
drop ECFET3d3;
rename ECFET3d3p ECFET3d3;
gen endowl4_spindexd3d1_1 = endowl4_spindexd3d1 / 1000;
drop endowl4_spindexd3d1;
rename endowl4_spindexd3d1_1 endowl4_spindexd3d1;
collapse (mean) ECFET3d1 endowl4_spindexd3d1 lincome3d1 lemp3d1 (sum) semp81, by(year FIPSCOUNTY); 
*
* PART (1): DO REGRESSIONS WITH SIC FES AND CORRELATIONS
*
* PART (A): LOOK AT IV FIRST STAGE
*;
xi: reg ECFET3d1 endowl4_spindexd3d1 i.year [fw=semp81], cluster(FIPSCOUNTY);
test endowl4_spindexd3d1;
*
* PART (B1): INCOME
*;
xi: ivreg lincome3d1 (ECFET3d1=endowl4_spindexd3d1 ) i.year [fw=semp81] , cluster(FIPSCOUNTY); 
sum lincome3d1 if endowl4_spindexd3d1 != .;
sum ECFET3d1 if endowl4_spindexd3d1 !=.;
*
* READ IN DATA
* 
* NOTE: ALL VALUES ARE NOMINAL
*;
clear;
* 
* NOTE: ALL VALUES ARE NOMINAL
*;
use "G:\whalley\projects\college_spending\programs\analysis\RESTAT_final\main_data.dta", replace;
*
* KEEP ONLY ABOVE MEDIAN GRAD FRACT COUNTIES
*;
keep if  high_colgrad == 1;
*
* DROP SMALL COUNTIES
*;
drop if totpop < 250000;
*
* REORMALIZE TOTAL EXPENDITURE
*;
gen ECFET3d1p = ECFET3d1 / 1000; 
drop ECFET3d1;
rename ECFET3d1p ECFET3d1;
gen ECFET3d3p = ECFET3d3 / 1000; 
drop ECFET3d3;
rename ECFET3d3p ECFET3d3;
gen endowl4_spindexd3d1_1 = endowl4_spindexd3d1 / 1000;
drop endowl4_spindexd3d1;
rename endowl4_spindexd3d1_1 endowl4_spindexd3d1;
collapse (mean) ECFET3d1 endowl4_spindexd3d1 lincome3d1 lemp3d1 (sum) semp81, by(year FIPSCOUNTY); 
*
* PART (1): DO REGRESSIONS WITH SIC FES AND CORRELATIONS
*
* PART (A): LOOK AT IV FIRST STAGE
*;
xi: reg ECFET3d1 endowl4_spindexd3d1 i.year [fw=semp81], cluster(FIPSCOUNTY);
test endowl4_spindexd3d1;
*
* PART (B1): INCOME
*;
xi: ivreg lincome3d1 (ECFET3d1=endowl4_spindexd3d1 ) i.year [fw=semp81] , cluster(FIPSCOUNTY); 
sum lincome3d1 if endowl4_spindexd3d1 != .;
sum ECFET3d1 if endowl4_spindexd3d1 !=.;
*
* READ IN DATA
* 
* NOTE: ALL VALUES ARE NOMINAL
*;
clear;
* 
* NOTE: ALL VALUES ARE NOMINAL
*;
use "G:\whalley\projects\college_spending\programs\analysis\RESTAT_final\main_data.dta", replace;
*
* KEEP ONLY BELOW MEDIAN COLLEGE GRAD INDUSTRIES
*;
keep if  high_colgrad == 0;
*
* DROP SMALL COUNTIES
*;
drop if totpop < 250000;
*
* REORMALIZE TOTAL EXPENDITURE
*;
gen ECFET3d1p = ECFET3d1 / 1000; 
drop ECFET3d1;
rename ECFET3d1p ECFET3d1;
gen ECFET3d3p = ECFET3d3 / 1000; 
drop ECFET3d3;
rename ECFET3d3p ECFET3d3;
gen endowl4_spindexd3d1_1 = endowl4_spindexd3d1 / 1000;
drop endowl4_spindexd3d1;
rename endowl4_spindexd3d1_1 endowl4_spindexd3d1;
collapse (mean) ECFET3d1 endowl4_spindexd3d1 lincome3d1 lemp3d1 (sum) semp81, by(year FIPSCOUNTY); 
*
* PART (1): DO REGRESSIONS WITH SIC FES AND CORRELATIONS
*
* PART (A): LOOK AT IV FIRST STAGE
*;
xi: reg ECFET3d1 endowl4_spindexd3d1 i.year [fw=semp81], cluster(FIPSCOUNTY);
test endowl4_spindexd3d1;
*
* PART (B1): INCOME
*;
xi: ivreg lincome3d1 (ECFET3d1=endowl4_spindexd3d1 ) i.year [fw=semp81] , cluster(FIPSCOUNTY); 
sum lincome3d1 if endowl4_spindexd3d1 != .;
sum ECFET3d1 if endowl4_spindexd3d1 !=.;
*
* CLOSE LOG, CLEAR AND END
*;
log close;
*clear;